#include <stdlib.h>
#include <time.h>
#include <stdio.h>


void menu()
{
    printf("*************************\n");
    printf("*******1. play  *********\n");
    printf("*******0. exit  *********\n");
    printf("*************************\n");
    printf("Please choose an option: ");   
}
void game()
{
    srand((unsigned int)time(NULL));
    int i = rand() % 50 + 1;
    int flag = 1;
    int b;
    while(flag)
    {
        scanf("%d", &b);
        if (b > i)
        {
            printf("Too high! Try again.\n");
        }
        else if (b < i)
        {
            printf("Too low! Try again.\n");
        }
        else
        {
            printf("Congratulations! You guessed the number %d correctly!\n", i);
            flag = 0;
        }
    }
}
int main()
{
    menu();
    int a;
    scanf("%d", &a);
    switch(a)
    {
        case 1:
        printf("game start!\n");
        game();
        break;
        case 0:
        printf("game exit!\n");
        break;
        default:
        printf("Invalid option, please try again!\n");
        break;
    }
    return 0;
}
